import {CSSProperties, useMemo} from 'react'

export const useShowStyle = (show: boolean, display = 'block') => {
  const style = useMemo((): CSSProperties => {
    return {
      display: show ? display : 'none'
    }
  }, [show, display])

  return {
    style
  }
}


export const useMergeStyled = (...params: CSSProperties[]) => {
  const styled = useMemo((): CSSProperties => {
    let arr = JSON.parse(JSON.stringify(params))
    let style = {}
    Object.assign(style, ...arr)
    return style
  }, [params])

  return {
    styled
  }
}
